package com.olt.result;

import java.util.List;

public class Result<T> {
    public  T value;

    public  ErrorEnum error;

    public List<T> list;

    public ErrorMsg msg;


    public T getValue() {
        return value;
    }

    public void setValue(T value) {
        this.value = value;
    }

    public ErrorEnum getError() {
        return error;
    }

    public void setError(ErrorEnum error) {
        this.error = error;
        msg= new ErrorMsg(error.Msg, error.Code);
    }

    public List<T> getList() {
        return list;
    }

    public void setList(List<T> list) {
        this.list = list;
    }

    public Result() {}

    public Result(T value, List<T> list) {
        this.value = value;
        this.list = list;
    }


    public ErrorMsg getMsg() {
        return msg;
    }

    public void setMsg(ErrorMsg msg) {
        this.msg = msg;
    }


    private class ErrorMsg{
        public ErrorMsg(String errorMsg, Integer errorCode) {
            ErrorMsg = errorMsg;
            ErrorCode = errorCode;
        }

        public String ErrorMsg;
        public Integer ErrorCode;
    }

}
